//2009/08/10 02:26:03
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

using namespace std;

class OnLineRank
{
public:
    int calcRanks(int k, vector <int> scores)
    {
        int rank = 0;
        for (int i = 0; i<scores.size(); i++)
        {
            rank++;
            for (int j = max(0,i-k); j<i; j++)
            {
                if (scores[j] > scores[i]) rank++;
            }
        }
        return rank;

    }
};
